perf(parser): avoid re-allocating when parsing import stmt#20666
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
b7bfa7f to
690724a
Compare
2d352a9 to
0373c67
Compare
690724a to
fefedb6
Compare
There was a problem hiding this comment.
Pull request overview
Improves parser performance for import declarations by avoiding an intermediate allocation when parsing named import specifiers, reusing an existing arena Vec instead.
Changes:
- Replaced
parse_import_specifiers(returning a newVec) withparse_import_specifiers_intothat appends directly into an existingspecifierslist. - Added
parse_delimited_list_intohelper to parse delimited lists into an existing arenaVec, avoiding re-allocation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/oxc_parser/src/js/module.rs | Switches import-specifier parsing to append into an existing specifiers vec to avoid creating a temporary vec. |
| crates/oxc_parser/src/cursor.rs | Introduces parse_delimited_list_into to support parsing directly into an existing list. |
fefedb6 to
2cb0cb3
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
Merge activity
|
0373c67 to
2b2794b
Compare
2cb0cb3 to
ad58dd7
Compare

No description provided.